<!-- container start -->
<div class="container">
	<div class="ui basic icon buttons">
		<div class="ui button" id="add-category">
			<i class="plus icon"></i>
		</div>
		<div class="ui button" id="delete-category">
			<i class="trash icon"></i>
		</div>
	</div>
	<table class="ui celled table">
		<thead>
			<tr>
				<th class="one wide">
					<div class="ui master checkbox">
						<input type="checkbox">
						<label></label>
					</div>
				</th>
				<th class="three wide">名称</th>
				<th class="three wide">创建时间</th>
				<th class="one wide">排序</th>
				<th class="three wide">操作</th>
			</tr>
		</thead>
		<tbody>
		<#if pageInfo?? && pageInfo.list?? && pageInfo.list?size gt 0>
			<#list pageInfo.list as item>
			<tr>
				<td>
					<div class="ui checkbox">
						<input type="checkbox">
						<label></label>
					</div>
				</td>
				<td>${item.name!}</td>
				<td>${item.createTime?string('yyyy-MM-dd HH:mm:ss')}</td>
				<td>${item.orderIndex!}</td>
				<td>
					<div class="ui horizontal list">
						<a class="item" href="javascript: editCategory(${item.id!})">编辑</a>
						<a class="item" href="javascript: deleteCategory(${item.id!})">删除</a>
						<#if item.isDefault?? && item.isDefault == '1'>
						<a class="item" href="javascript: changeDefatul(${item.id},0)">取消默认</a>
						<#elseif item.isDefault?? && item.isDefault == '0'>
						<a class="item" href="javascript: changeDefatul(${item.id},1)"">设为默认</a>
						</#if>
					</div>
				</td>
			</tr>
			</#list>
		<#else>
			<tr><td style="text-align: center;" colspan="5">没有任何文章分类</td></tr>
		</#if>
		</tbody>
		<tfoot>
			<tr>
				<th colspan="7">
					<div class="ui right floated pagination menu">
						<div class="icon item"> <i class="angle double left icon"></i></div>
						<#if pageInfo?? && pageInfo.navigatepageNums?? && pageInfo.navigatepageNums?size gt 0>
						<#list pageInfo.navigatepageNums as item>
						<div class="item" onclick="pageHelper(${item});">${item!}</div>
						</#list>
						</#if>
						<div class="icon item"><i class="angle double right icon"></i></div>
					</div>
				</th>
			</tr>
		</tfoot>
	</table>
</div><!-- container end -->

<form id="pageHelperForm">
<input type="hidden" name="pageNum" id="pageNum" value="${pageInfo.pageNum!'1'}"> 
</form>



<!-- add category modal start  -->
<div class="ui small modal" id="add-category-modal">
	 <i class="close icon"></i>
	<div class="header">新增文章类别</div>
	<div class="content">
		<form class="ui equal width form" id="add-category-form">
			<div class="field">
				<label>分类名称</label> <input type="text" name="name"
					style="width: 100%;">
			</div>
			<div class="field">
				<label>分类说明</label> <input type="text" name="content"
					style="width: 100%;">
			</div>
			<div class="fields">
				<div class="field">
					<label>索引位置</label> <input type="text" name="orderIndex" value="50" style="width: 100%;">
				</div>
				<!--  
				<div class="field">
					<label>设为默认</label>
					<select class="ui search dropdown" name="isDefault">
					    <option value="0">不用了</option>
						<option value="1">好的</option>
					</select>
				</div>
				-->
				<div class="field">
					<label>是否公开</label>
					<select class="ui search dropdown" name="isPublic">
						<option value="1">是的</option>
						<option value="0">不可以</option>
					</select>
				</div>
			</div>
			<div class="ui error message" id="add-category-message"></div>
		</form>
	</div>
	<div class="actions">
		<div class="ui primary button" id="add-category-primary">确定</div>
		<div class="ui negative button" id="add-category-negative">取消</div>
	</div>
</div>
<!-- add category modal end -->


<!-- edit category modal start  -->
<div class="ui small modal" id="edit-category-modal">
	 <i class="close icon"></i>
	<div class="header">修改文章类别</div>
	<div class="content">
		<form class="ui equal width form" id="edit-category-form">
			<input type="hidden" name="id">
			<div class="field">
				<label>分类名称</label> <input type="text" name="name"
					style="width: 100%;">
			</div>
			<div class="field">
				<label>分类说明</label> <input type="text" name="content"
					style="width: 100%;">
			</div>
			<div class="fields">
				<div class="field">
					<label>索引位置</label> <input type="text" name="orderIndex" value="50" style="width: 100%;">
				</div>
				<!--  
				<div class="field">
					<label>设为默认</label>
					<select class="ui search dropdown" name="isDefault">
					    <option value="0">不用了</option>
						<option value="1">好的</option>
					</select>
				</div>
				-->
				<div class="field">
					<label>是否公开</label>
					<select class="ui search dropdown" name="isPublic">
						<option value="1">是的</option>
						<option value="0">不可以</option>
					</select>
				</div>
			</div>
			<div class="ui error message" id="edit-category-message"></div>
		</form>
	</div>
	<div class="actions">
		<div class="ui primary button" id="edit-category-primary">更新</div>
		<div class="ui negative button" id="edit-category-negative">取消</div>
	</div>
</div>
<!-- edit category modal end -->



<div class="ui small modal" id="confirm-delete-modal">
  <i class="close icon"></i>
  <div class="header">
   	 删除文章分类
  </div>
  <div class="content">确认删除该文章分类</div>
    <div class="actions">
    <div class="ui black deny button">
      取消
    </div>
    <div class="ui positive button">
      确认
    </div>
  </div>
</div>



<script type="text/javascript" src="<@full_path path='js/category/manage.js' />"></script>
<script type="text/javascript" src="<@full_path path='js/util/checkbox.js' />"></script>
